import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    userInfo: null,
    sessionId: null
  },
  mutations: {
    setBaseUserInfo(state, userInfo) {
      state.userInfo = userInfo
    },
    setBaseUserInfo(state, provider){
			state.baseUserInfo = JSON.parse(provider);
		},
    setSessionId(state, sessionId) {
      state.sessionId = sessionId
    }
  },
  actions: {
    // 可以添加异步操作
  },
  getters: {
    isLoggedIn: state => !!state.sessionId
  }
}) 